package chpt11;

import java.net.MalformedURLException;
import java.net.URL;

public class URLTest {
	public static void main(String[] args)
			throws MalformedURLException {
		URL url = new URL("http://admin:123456@www.example.com:8080/"
				+ "test/index.html?str=java#chapter1");
		System.out.println("Protocol:"+url.getProtocol());
		System.out.println("UserInfo:"+url.getUserInfo());
		System.out.println("Host:"+url.getHost());
		System.out.println("Port:"+url.getPort());
		System.out.println("Authority:"+url.getAuthority());
		System.out.println("File:"+url.getFile());		
		System.out.println("Query:"+url.getQuery());
		System.out.println("Ref:"+url.getRef());
	}
}
